

cc.Class({
    extends: cc.Component,

    onLoad()
    {
        cc.macro.ENABLE_MULTI_TOUCH = false
        
        cc.debug.setDisplayStats(false)
        
        if (!window.Log)
        {
            window.Log = require('Log')
        }

        let app = require('App')
        app.setup()

        require('Ogre')

        const platform = app.configBy('platform')
        if (platform && platform.length > 2)
        {
            let SdkPatform = require(platform)

            ogre.sdkPlatform = new SdkPatform()
            ogre.sdkPlatform.init()
        }
        else
        {
            if (ogre.sdkPlatform)
            {
                ogre.sdkPlatform = null
            }
        }

        let ss = require('SceneSession').share()
        ss.init()

        ogre.localize.init(
            ()=>{
                ss.go()

                if (cc.sys.isNative)
                {
                    jsb.Device.setKeepScreenOn(true)

                    if (cc.sys.os == cc.sys.OS_ANDROID)
                    {
                        cc.systemEvent.on(cc.SystemEvent.EventType.KEY_DOWN, this.onKeyDown, this)
                    }
                }
            }
        )
    },

    onDestroy()
    {
        if (cc.sys.isNative && cc.sys.os == cc.sys.OS_ANDROID)
        {
            cc.systemEvent.off(cc.SystemEvent.EventType.KEY_DOWN, this.onKeyDown, this)
        }
    },

    onKeyDown(e)
    {
        if (e.keyCode == cc.macro.KEY.back)
        {
            
        }
    }
})
